<?php

namespace app\xinrong\model;

use think\Model;

class XinrongMaterialModel extends Model
{
    /* 自动处理时间 */
    protected $autoWriteTimestamp = 'int';

    protected function setRegTimeAttr($fields)
    {
        return is_numeric($fields) ? $fields : strtotime($fields);
    }

    protected function setAnnualAuditTimeAttr($fields)
    {
        return is_numeric($fields) ? $fields : strtotime($fields);
    }

    public function costs()
    {
        return $this
            ->hasMany('xinrongCostModel','pid');
    }
}